﻿using System;
using System.ComponentModel;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using WebPart = System.Web.UI.WebControls.WebParts.WebPart;

namespace TL.GoogleMapWebPart.VisualWebPart1
{
    [ToolboxItemAttribute(false)]
    public partial class VisualWebPart1 : WebPart
    {
        #region properties
        private string _address = "1 martin place, nsw, australia";
        [Personalizable(), WebPartStorage(Storage.Shared), WebBrowsable(),
        WebDisplayName("Address"), WebDescription("Please specify address(e.g. '1 martin place, nsw, australia')")]
        public string Address
        {
            get
            {
                return this._address;
            }
            set
            {
                this._address = value;
            }
        }

        private string _addressTitle= "Martin Place";
        [Personalizable(), WebPartStorage(Storage.Shared), WebBrowsable(),
        WebDisplayName("Address Title"), WebDescription("Please specify address title")]
        public string AddressTitle
        {
            get
            {
                return this._addressTitle;
            }
            set
            {
                this._addressTitle = value;
            }
        }


        private string _addressDescription = @"<h3>Martin Place in Sydeny</h3><p>Sydney is a nice place</p>";
        [Personalizable(), WebPartStorage(Storage.Shared), WebBrowsable(),
        WebDisplayName("Address Description"), WebDescription("Please specify address description")]
        public string AddressDescription
        {
            get
            {
                return this._addressDescription;
            }
            set
            {
                this._addressDescription = value;
            }
        }

        private string _mapWidth = "600px";
        [Personalizable(), WebPartStorage(Storage.Shared), WebBrowsable(),
        WebDisplayName("Map Width"), WebDescription("Please specify map width(e.g. '600px')")]
        public string MapWidth
        {
            get
            {
                return this._mapWidth;
            }
            set
            {
                this._mapWidth = value;
            }
        }


        private string _mapHeight = "400px";
        [Personalizable(), WebPartStorage(Storage.Shared), WebBrowsable(),
        WebDisplayName("Map Height"), WebDescription("Please specify map height (e.g. '400px')")]
        public string MapHeight
        {
            get
            {
                return this._mapHeight;
            }
            set
            {
                this._mapHeight = value;
            }
        }

        private string _mapType = "0";
        [Personalizable(), WebPartStorage(Storage.Shared), WebBrowsable(),
        WebDisplayName("Map Type"), WebDescription("Please specify Map Type(0 - Road map, 1 - Satellite, 2 - Hybrid ,3 - Terrain)")]
        public string MapType
        {
            get
            {
                return this._mapType;
            }
            set
            {
                this._mapType = value;
            }
        }


        #endregion
        // Uncomment the following SecurityPermission attribute only when doing Performance Profiling using
        // the Instrumentation method, and then remove the SecurityPermission attribute when the code is ready
        // for production. Because the SecurityPermission attribute bypasses the security check for callers of
        // your constructor, it's not recommended for production purposes.
        // [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)]
        public VisualWebPart1()
        {
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            InitializeControl();
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
